<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * author Hieu Ho
 */

class Becometutor extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('becometutor_model');
    }

    public function index($id) {
        $this->load->model('thanhvien_model');
        $data['query'] = $this->thanhvien_model->get_user($id);
        $data['monhoc'] = $this->display_monhoc();
        $this->load->library('form_validation');
        // field name, error message, validation rules
        $this->form_validation->set_rules('NamSinh', 'Năm Sinh', 'trim|required');
        $this->form_validation->set_rules('NoiSinh', 'Nơi Sinh ', 'trim|required');
//        $this->form_validation->set_rules('DiaChi', 'Địa Chỉ', 'trim|required');
        $this->form_validation->set_rules('HocTruong', 'Học Trường', 'trim|required');
        $this->form_validation->set_rules('ChuyenNganh', 'Chuyên Ngành', 'trim|required');
        $this->form_validation->set_rules('NamTotNghiep', 'Năm Tốt Nghiệp', 'trim|required');
        $this->form_validation->set_rules('HienLa', 'Hiện Là', 'trim|required');
        $this->form_validation->set_rules('KhoiLopDay', 'Khối Lớp Dạy', 'trim|required');
        $this->form_validation->set_rules('KhuVucDay', 'Khu Vực Dạy', 'trim|required');
//        $this->form_validation->set_rules('ThoiGianDay', 'Thời Gian Dạy', 'trim|required');                               $this->form_validation->set_rules('KhoiLopDay', 'Khối Lớp Dạy', 'trim|required');
        $this->form_validation->set_rules('SoBuoiDay', 'Số Buổi Dạy', 'trim|required');
        $this->form_validation->set_rules('MucLuongYeuCau', 'Mức Lương Yêu Cầu ', 'trim|required');
        if ($this->form_validation->run() == FALSE) {
            $this->render('/giaodich/becometutor_view.php', $data);
        } else {
            $this->becometutor_model->add_lamgiasu($id);
            $this->render('/giaodich/display_lamgiasu_thank', $data);
        }
    }

    public function display_monhoc() {
        $this->load->model('display_model');
        return $this->display_model->load_monhoc();
    }

    function render($path, $data) {
        $this->load->view('user/common/header_view', $data);
        $this->load->view('user/common/left_sidebar_view', $data);
        $this->load->view('user/common/head_content_view', $data);
        $this->load->view($path, $data);
        $this->load->view('user/common/right_sidebar_view', $data);
        $this->load->view('user/common/footer_view', $data);
    }

}

?>
